package com.ruoyi.student.service.impl;

import com.ruoyi.student.domain.Student;
import com.ruoyi.student.mapper.StudentMapper;
import com.ruoyi.student.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper mapper;
//    service 是接口，并没有真的实现方法
//    serviceImpl 实现了接口，因此需要在serviceImpl 里面来写真正的方法体
    @Override
    public List<Student> getStudentList() {
//        需要在这里调用mapper
        return mapper.queryAll();
    }

    @Override
    public int addStudent(Student student) {
        return mapper.addStudent(student);
    }

    @Override
    public List<Student> queryStudentByName(String sname) {
        return mapper.queryStudentByName(sname);
    }

    @Override
    public void updateStudent(Student student) {
       mapper.updateStudent(student);
    }

    @Override
    public void deleteStudent(int id) {
        mapper.deleteStudent(id);
    }

}
